import React, { Component } from "react";
import { withRouter, NavLink } from "react-router-dom";
import { observer, inject } from "mobx-react";

@withRouter
@inject("obser", "newStore")
@observer
class View extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }
  hdFn(e, text) {
    const { setName } = this.props.newStore;
    // console.log(text);
    setName(text);
  }
  render() {
    const { name } = this.props.newStore;
    return (
      <React.Fragment>
        <NavLink to="storepage">storepage</NavLink>
        <NavLink to="newstore">newstore</NavLink>
        <NavLink to="page">page</NavLink>
        <div>他的名字：{name}</div>
        <input
          type="button"
          value="更换名字"
          onClick={(e) => {
            this.hdFn(e, "ajax值");
          }}
        />
      </React.Fragment>
    );
  }
}
export default View;
